package com.duqc.designpattern.decorator;

import lombok.extern.slf4j.Slf4j;

/**
 * @ClassName DecoratorTest
 * @Description TODO
 * @Author duqc
 * @Date 2021/5/11
 **/
@Slf4j
public class DecoratorTest {

    public static void main(String[] args) {
        String content = "duqc";
        String password = "123456789";
        //MD5
        EncryptionBase md5 = new MD5Encryption();
        log.info(md5.encrypt(content, password));
        //AES
        EncryptionBase aes = new AESEncryption();
        log.info(aes.encrypt(content, password));
        //DES
        EncryptionBase des = new DESEncryption();
        log.info(des.encrypt(content, password));
        //MD5-AES
        EncryptionBase md5Aes = new AESEncryptionDecorator(new MD5Encryption());
        log.info(md5Aes.encrypt(content, password));
        //MD5-DES
        EncryptionBase md5Des = new DESEncryptionDecorator(new MD5Encryption());
        log.info(md5Des.encrypt(content, password));
        //MD5-AES-DES
        EncryptionBase md5AesDes = new DESEncryptionDecorator(new AESEncryptionDecorator(new MD5Encryption()));
        log.info(md5AesDes.encrypt(content, password));
        //AES-MD5-DES
        EncryptionBase aesMd5Des = new DESEncryptionDecorator(new MD5EncryptionDecorator(new AESEncryption()));
        log.info(aesMd5Des.encrypt(content, password));
        //DES-AES
        EncryptionBase desAes = new AESEncryptionDecorator(new DESEncryption());
        log.info(desAes.encrypt(content, password));
        //DES-AES-MD5
        EncryptionBase desAesMd5 = new MD5EncryptionDecorator(new AESEncryptionDecorator(new DESEncryption()));
        log.info(desAesMd5.encrypt(content, password));
    }

}
